const Quill = require('quill')
const BlockEmbed = Quill.import('blots/block/embed')

export class Video extends BlockEmbed {
  static create(value) {
    const node = super.create(value)
    node.setAttribute('src', value)
    node.setAttribute('width', '100%')
    node.setAttribute('controls', 'controls')
    return node
  }

  static value(node) {
    return node.getAttribute('src')
  }
}

Video.blotName = 'video'
Video.tagName = 'Video'
Video.className = 'ql-video'
